package com.msk.base.service.goods;

import com.msk.base.domain.goods.BaseDistance;
import com.msk.base.mapper.goods.BaseDistanceDao;
import com.msk.sys.service.CrudService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 运距管理Service
 *
 * @author wlxiang
 *
 * @version 20230606
 */
@Service
@Transactional(readOnly = true)
public class BaseDistanceService extends CrudService<BaseDistanceDao, BaseDistance> {

    @Autowired
    private BaseDistanceDao baseDistanceDao;

    /**
     * @Description 新增运距
     * @Author wlxiang
     * @Date 16:22 2023/6/9
     * @Param
     * @param baseDistance
     * @return int
     **/
    @Transactional(readOnly = false)
    public int insert(BaseDistance baseDistance){
        return baseDistanceDao.insert(baseDistance);
    };

    /**
     * @Description 编辑运距
     * @Author wlxiang
     * @Date 17:01 2023/6/9
     * @Param 
     * @param baseDistance
     * @return int
     **/
    @Transactional(readOnly = false)
    public int update(BaseDistance baseDistance){
        return baseDistanceDao.update(baseDistance);
    };

    /**
     * @Description 删除运距
     * @Author wlxiang
     * @Date 17:10 2023/6/9
     * @Param
     * @param id
     * @return int
     **/
    @Transactional(readOnly = false)
    public int delete(String id){
        return baseDistanceDao.delete(id);
    };

    /**
     * @Description 查询公共和私有运距数据
     * @Author wlxiang
     * @Date 19:18 2023/6/6
     * @Param 
     * @param affiliatedPersonId
     * @param startNameOrDistance
     * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    public List<Map<String,Object>> selectDistanceList(String affiliatedPersonId,String startNameOrDistance){
        return baseDistanceDao.selectDistanceList(affiliatedPersonId,startNameOrDistance);
    }

    /**
     * @Description 我的运距
     * @Author wlxiang
     * @Date 16:10 2023/6/9
     * @Param
     * @param affiliatedPersonId
     * @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
     **/
    public List<Map<String,Object>> selectMyDistanceList(String affiliatedPersonId){
        return baseDistanceDao.selectMyDistanceList(affiliatedPersonId);
    }
}
